package com.oocl.batchdatav2.processor.impl;

import java.util.Comparator;
import java.util.List;

import com.oocl.batchdatav2.analyzer.DataAnalyzer;
import com.oocl.batchdatav2.analyzer.impl.DataAnalyzerImpl;
import com.oocl.batchdatav2.formatter.DataFormatter;
import com.oocl.batchdatav2.formatter.impl.DataFormatterImpl;
import com.oocl.batchdatav2.pojo.Customer;
import com.oocl.batchdatav2.processor.DataProcessor;

public class DataProcessorImpl implements DataProcessor {
	
	private DataAnalyzer analyzer;
	private DataFormatter formatter;
	
	public DataProcessorImpl(List<Customer> customerList) {
		analyzer = new DataAnalyzerImpl(customerList);
		formatter = new DataFormatterImpl();
	}

	@Override
	public StringBuilder process(Comparator<Customer> comparator, String format) {
		return formatter.getCustomersAsString(analyzer.sortBy(comparator), format);
	}

}
